import 'dart:io';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';

class MyAvatarWidget extends StatelessWidget {
  final String imgPath;

  const MyAvatarWidget({Key key, @required this.imgPath}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Hero(
      tag: "avatar",
      child: Container(
        width: 66.0,
        height: 66.0,
        decoration: BoxDecoration(
            boxShadow: [
              BoxShadow(
                  color: Color(0xffe6e6e6),
                  offset: Offset(5.0, 5.0),
                  blurRadius: 8.0,
                  spreadRadius: 1.0),
            ],
            image: DecorationImage(
                image: imgPath == "assets/image/avatar.jpeg"
                    ? AssetImage(imgPath)
                    : FileImage(File(imgPath))),
            border: Border.all(color: Colors.white, width: 4.0),
            borderRadius: BorderRadius.circular(33.0)),
      ),
    );
  }
}
